<?php
	session_start();
	
	header("Content-type image/jpge");
	
	$img = imagecreatetruecolor(50,20);
	
	$back = ImageColorAllocate($img,73,86,119);
	imagefill($img,0,0,$back);
	
	$vcode = '';
	for($i=0;$i<4;$i++){
		
		$col = imagecolorallocate($img,rand(150,255),rand(150,255),rand(150,255));
		$rand = dechex(rand(0,15));
		$vcode .= $rand;
		imagestring($img,6,rand($i*12,$i*12+6),rand(2,7),$rand,$col);
	}	
	
	$_SESSION['check_code'] = $vcode;
	
	for($i=0;$i<100;$i++){
		
		$co = imagecolorallocate($img,rand(0,255),rand(0,255),rand(0,255));
		imagesetpixel($img,rand(0,50),rand(0,25),$co);
	}
	
	for($i=0;$i<4;$i++){
		
		$co = imagecolorallocate($img,rand(0,200),rand(0,200),rand(0,200));
		imagedashedline($img,rand(0,50),rand(0,10),rand(0,50),rand(10,20),$co);
		//imageline($img,rand(0,50),rand(0,10),rand(0,50),rand(10,20),$co);
	}
	
	imagejpeg($img);

?>